import request from '@/utils/request'
import qs from 'qs'


export function initData(url, params,type='get') {
  if (type==='get'){
    return request({
      url: url + '?' + qs.stringify(params, { indices: false }),
      method: 'get'
    })
  }else if (type==='post'){
    return request({
      url: url ,
      method: 'post',
      data:params
    })
  }
}

// export function initData(url, params) {
//   return request({
//     url: url + '?' + qs.stringify(params, { indices: false }),
//     method: 'get'
//   })
// }
export function initDataPlus(url, params) {
  return request({
    url: url + '?' + qs.stringify(params, { indices: false }),
    method: 'get'
  })
}
export function download(url, params,type) {
  if (!type || type==='get'){
    return request({
      url: url + '?' + qs.stringify(params, { indices: false }),
      method: 'get',
      responseType: 'blob'
    })
  }else if (type==='post'){
    return request({
      url: url ,
      method: 'post',
      data:params,
      responseType: 'blob'
    })
  }
}

// export function download(url, params) {
//   return request({
//     url: url + '?' + qs.stringify(params, { indices: false }),
//     method: 'get',
//     responseType: 'blob'
//   })
// }
export function webProperties(data) {
  return request({
    url: '/api/common/webProperties',
    method: 'post',
    data
  })
}

export function getWebProperties(params) {
  return request({
    url: '/api/common/getWebProperties',
    method: 'get',
    params
  })
}
//获取用户生日
export function birthdayRemind(){
  return request({
    url: '/api/webIndex/birthdayRemind',
    method: 'get',
  })
}

